package vivace.view;

import java.awt.*;
import java.util.*;

import javax.swing.*;

import vivace.helper.GUIHelper;
import vivace.model.*;

/**
 * TackContent - contains the timeline and the different views available: pianoroll etc.
 */
public class TrackContent extends JScrollPane implements Observer {
	
	private Project model;
	private JPanel content;
	
	public TrackContent(Project model) {
		
		this.model = model;
		this.model.addObserver(this);
		
		//Create a new timeline
		Timeline timeline = new Timeline(model);
		timeline.setPreferredSize(new Dimension(this.getWidth(), GUIHelper.HEADER_HEIGHT));
		
		//Creates the Perspective panel
		Perspective perspective = new Perspective(model);
		
		content = new JPanel(new BorderLayout());
		
		// add components
		content.add(timeline, BorderLayout.NORTH);
		content.add(perspective, BorderLayout.CENTER);
		
		//Let the JScrollPane show the splitPane
		this.setViewportView(content);
		

	}
	
	public void update(Observable o,Object arg) { 
		
		this.setViewportView(content);
		
	}


}
